﻿@model PhotoGallery.Models.ViewModels.VideoViewModel
@using PhotoGallery.Views
@{
    ViewBag.Title = "Preview";
}
<h2>Preview</h2>
<div style="text-align:right">
    @Html.ActionLink(Labels.manage, "List") |
    <a href=@Url.Content("~/Albums")>@Labels.back</a>
</div>
@if (Model.Videos.Count() > 0)
{
    <div style="float:left; background-color:black">
    
        <video width="640" height="480" controls autoplay>
            @*<source src="@Url.Content(@Model.Video.UrlWebm)" type="video/webm">*@
            @*<source src="@Url.Action("DownloadVideo", new { file = @Model.Video.FullFileName })" type="video/mp4">*@
            @foreach (var item in Model.VideoAttachments)
            {
                if (File.Exists(item.FullFileName))
                {
                    @*<source src="@Url.Action("DownloadVideo", new { file = item.FullFileName, mimeType=item.MimeType })" type="@item.MimeType">*@
                    <source src="@Url.Content(item.Url)" type="@item.MimeType">
                }
            }
            <source src="@Url.Content(@Model.Video.Url)" type="@Model.Video.MimeType">
            @*<object width="320" height="240" type="application/x-shockwave-flash"
            data="flowplayer-3.2.1.swf"> 
                <param name="movie" value="flowplayer-3.2.1.swf" /> 
                <param name="allowfullscreen" value="true" /> 
                <param name="flashvars" value='config={"clip": {"url": "@Url.Action("DownloadVideo", new { file = @Model.Video.FullFileName })", "autoPlay":false, "autoBuffering":true}}' /> 
                <p>Download video as <a href="pr6.mp4">MP4</a>, <a href="pr6.webm">WebM</a>, or <a href="pr6.ogv">Ogg</a>.</p> 
            </object>*@

            Your browser does not support the video tag.
        </video>
    </div>
    <div style="float:left; padding-left:20px">
        @foreach (var video in Model.Videos)
        {
            if(video.ID != Model.Video.ID)
            {
                <div>
                    <a href="@Url.Action("Show","Video",new { id = video.ID })">
                        <img alt="@video.Title" src="@Url.Action("Thumbnail", new { file = video.FullThumbnailName })"/>
                    </a>
                    <p>@video.Title</p>
                </div>
            }
        }
    </div>
}
else
{
    <div>                       
        <a href="@Url.Action("Create")">
            <img alt="" src="@Url.Content("~//Content//no_video.jpg")" class="thumbnail-border" width="180" />
        </a>
        <p></p>
    </div>
}